<template>
	<view class="all">
		<view class="box" @click="save">
			<view class="box_text"> 用户头像 </view>
			<view style="display: flex;">
				<image :src="list_data.avatar_url" class="box_img"></image>
				<uni-icons type="forward" style="margin-top: 15upx;color: #999;" size="16"></uni-icons>
			</view>
		</view>
		<view class="box" @click="save">
			<view class="box_text"> 用户昵称 </view>
			<view style="display: flex;">
				<view class="box_texts">{{list_data.nickname}} </view>
				<uni-icons type="forward" style="margin-top: 8upx;color: #999;" size="16"></uni-icons>
			</view>
		</view>
		<view style="width: 100%;height: 22upx;background: #ddd;"></view>
		<view class="box">
			<view class="box_text"> 登录账号 </view>
			<view style="display: flex;">
				<view class="box_texts"> {{list_data.account}} </view>
				<!-- <uni-icons type="forward" style="margin-top: 8upx;color: #999;" size="16"></uni-icons> -->
			</view>
		</view>
		<view class="box">
			<view class="box_text"> 手机号码 </view>
			<view style="display: flex;">
				<view class="box_texts"> {{list_data.phone}} </view>
				<!-- <uni-icons type="forward" style="margin-top: 8upx;color: #999;" size="16"></uni-icons> -->
			</view>
		</view>
		<view class="box">
			<view class="box_text"> 激活状态 </view>
			<view style="display: flex;">
				<view class="box_texts"> {{list_data.vip >= 1?'已激活':'未激活'}}  </view>
				<!-- <uni-icons type="forward" style="margin-top: 8upx;color: #999;" size="16"></uni-icons> -->
			</view>
		</view>
		<view class="box">
			<view class="box_text"> 会员级别 </view>
			<view style="display: flex;">
				<view class="box_texts" v-if="list_data.level == 0">普通用户 </view>
				<view class="box_texts" v-if="list_data.level == 1">区代理 </view>
				<view class="box_texts" v-if="list_data.level == 2">市代理 </view>
				<view class="box_texts" v-if="list_data.level == 3">省代理 </view>
				<view class="box_texts" v-if="list_data.level == 4">合伙人 </view>
				<!-- <uni-icons type="forward" style="margin-top: 8upx;color: #999;" size="16"></uni-icons> -->
			</view>
		</view>
		<view class="box">
			<view class="box_text"> 注册时间 </view>
			<view style="display: flex;">
				<view class="box_texts"> {{list_data.addtime}} </view>
				<!-- <uni-icons type="forward" style="margin-top: 8upx;color: #999;" size="16"></uni-icons> -->
			</view>
		</view>
		<view class="box" @click="setClipboardData(list_data.code)">
			<view class="box_text"> 推荐码 </view>
			<view style="display: flex;">
				<view class="box_texts"> {{list_data.code}} </view>
				<uni-icons type="forward" style="margin-top: 8upx;color: #999;" size="16"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list_data:{}
			}
		},
		onShow() {
			this.user_person_api()
		},
		methods: {
			save() {
				uni.navigateTo({
					url:'../save/save'
				})
			},
			setClipboardData(num) {
				uni.setClipboardData({
					data: num,
					success: function () {
						console.log('success');
					}
				});

			},
			user_person_api() {
				var that = this
				that.$request(that.$Api.user_person_api, {
					access_token: uni.getStorageSync('access_token'),
				}, "POST").then(res => {
					if (res.data.code == 0) {
						that.list_data = res.data.data.list
					} else {
						uni.showToast({
							title: res.data.msg,
							duration: 2000,
							icon: 'none'
						});
					}
				})
			},
		}
	}
</script>

<style lang="less">
	page{
		.all{
			.box{
				.box_text{
					font-size: 32upx;
					font-weight: bold;
					color: #999;
				}
				.box_texts{
					font-size: 32upx;
					font-weight: 400;
					color: #999;
				}
				.box_img{
					width: 60upx;
					height: 60upx;
					border-radius: 50%;
				}
				display: flex;
				justify-content: space-between;
				width: 700upx; 
				padding: 35upx 25upx;
				border-bottom: 1upx solid #ddd;
			}
		}
	}
</style>
